{% extends "base.html" %}

{% block title %}登录 - 畅读小说网{% endblock %}

{% block content %}
<div class="login-container">
    <h2>欢迎登录</h2>

    {% if messages %}
    <div class="messages">
        {% for message in messages %}
        <div class="alert {% if message.tags %}alert-{{ message.tags }}{% endif %}">
            {{ message }}
        </div>
        {% endfor %}
    </div>
    {% endif %}

    <form method="post" action="{% url 'login' %}">
        {% csrf_token %}
        <div class="form-group">
            <label for="username">用户名</label>
            <input type="text" name="username" id="username" required>
        </div>
        <div class="form-group">
            <label for="password">密码</label>
            <input type="password" name="password" id="password" required>
        </div>
        <div class="form-check">
            <input type="checkbox" name="remember" id="remember" class="form-check-input">
            <label for="remember" class="form-check-label">记住我</label>
        </div>
        <button type="submit" class="btn btn-primary">登录</button>
    </form>

    <div class="register-link">
        <p>还没有账号？<a href="{% url 'register' %}">立即注册</a></p>
    </div>
</div>
{% endblock %}